package com.lyjStudy.train.batch.feign;

import com.lyjStudy.train.common.resp.CommonResp;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Date;

// 方式一：集成注册中心（推荐）
//@FeignClient(name = "business") // 直接使用服务名

//// 方式二：未集成注册中心（测试环境）
//@FeignClient(name = "business", url = "http://127.0.0.1:8002/business")

@FeignClient(value = "business", fallback = BusinessFeignFallback.class)
public interface BusinessFeign {

    @GetMapping("/business/hello") // 映射目标服务的 API 路径
    String hello();

    @GetMapping("/business/admin/daily-train/gen-daily/{date}")
    CommonResp<Object> genDaily(@PathVariable @DateTimeFormat(pattern = "yyyy-MM-dd") Date date);
}